<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span> Copyright (c) 2007 Brian Dillard and Brad Neuberg:
<span class='line'>  3</span> Brian Dillard | Project Lead | bdillard@pathf.com | http://blogs.pathf.com/agileajax/
<span class='line'>  4</span> Brad Neuberg | Original Project Creator | http://codinginparadise.org
<span class='line'>  5</span>    
<span class='line'>  6</span> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
<span class='line'>  7</span> (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
<span class='line'>  8</span> publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
<span class='line'>  9</span> so, subject to the following conditions:
<span class='line'> 10</span> 
<span class='line'> 11</span> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
<span class='line'> 12</span> 
<span class='line'> 13</span> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<span class='line'> 14</span> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
<span class='line'> 15</span> FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
<span class='line'> 16</span> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<span class='line'> 17</span> */</span><span class="WHIT">
<span class='line'> 18</span> 
<span class='line'> 19</span> </span><span class="COMM">/*
<span class='line'> 20</span> 	dhtmlHistory: An object that provides history, history data, and bookmarking for DHTML and Ajax applications.
<span class='line'> 21</span> 	
<span class='line'> 22</span> 	dependencies:
<span class='line'> 23</span> 		* the historyStorage object included in this file.
<span class='line'> 24</span> 
<span class='line'> 25</span> */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="NAME">dhtmlHistory</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> 	
<span class='line'> 28</span> 	</span><span class="COMM">/*Public: User-agent booleans*/</span><span class="WHIT">
<span class='line'> 29</span> 	</span><span class="NAME">isIE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 30</span> 	</span><span class="NAME">isOpera</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 31</span> 	</span><span class="NAME">isSafari</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 32</span> 	</span><span class="NAME">isKonquerer</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 33</span> 	</span><span class="NAME">isGecko</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 34</span> 	</span><span class="NAME">isSupported</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 35</span> 	
<span class='line'> 36</span> 	</span><span class="COMM">/*Public: Create the DHTML history infrastructure*/</span><span class="WHIT">
<span class='line'> 37</span> 	</span><span class="NAME">create</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 38</span> 		</span><span class="COMM">/*
<span class='line'> 39</span> 			options - object to store initialization parameters
<span class='line'> 40</span> 			options.debugMode - boolean that causes hidden form fields to be shown for development purposes.
<span class='line'> 41</span> 			options.toJSON - function to override default JSON stringifier
<span class='line'> 42</span> 			options.fromJSON - function to override default JSON parser
<span class='line'> 43</span> 		*/</span><span class="WHIT">
<span class='line'> 44</span> 
<span class='line'> 45</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">that</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> 
<span class='line'> 47</span> 		</span><span class="COMM">/*set user-agent flags*/</span><span class="WHIT">
<span class='line'> 48</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">UA</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 49</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">platform</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">navigator.platform.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 50</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vendor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">navigator.vendor</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">vendor</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"KDE"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 52</span> 			</span><span class="NAME">this.isKonqueror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> 			</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window.opera</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 55</span> 			</span><span class="NAME">this.isOpera</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> 			</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 57</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.all</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</span> 			</span><span class="NAME">this.isIE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> 			</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">vendor.indexOf</span><span class="PUNC">(</span><span class="STRN">"Apple Computer, Inc."</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> 			</span><span class="NAME">versionString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">UA.substring</span><span class="PUNC">(</span><span class="NAME">UA.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"version"</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">8</span><span class="PUNC">,</span><span class="NAME">UA.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"safari"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'> 62</span> 			</span><span class="NAME">versionNumber</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">versionString</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'> 63</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NAME">versionNumber</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">versionNumber</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'> 64</span> 				</span><span class="NAME">this.isSafari</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 65</span> 				</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">platform.indexOf</span><span class="PUNC">(</span><span class="STRN">"mac"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> 			</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NAME">versionNumber</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">versionNumber</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'> 67</span> 				</span><span class="NAME">this.isGecko</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 68</span> 				</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 69</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 70</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">UA.indexOf</span><span class="PUNC">(</span><span class="STRN">"gecko"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 71</span> 			</span><span class="NAME">this.isGecko</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> 			</span><span class="NAME">this.isSupported</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 74</span> 
<span class='line'> 75</span> 		</span><span class="COMM">/*Set up the historyStorage object; pass in init parameters*/</span><span class="WHIT">
<span class='line'> 76</span> 		</span><span class="NAME">window.historyStorage.setup</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> 
<span class='line'> 78</span> 		</span><span class="COMM">/*Execute browser-specific setup methods*/</span><span class="WHIT">
<span class='line'> 79</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isSafari</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 80</span> 			</span><span class="NAME">this.createSafari</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isOpera</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 82</span> 			</span><span class="NAME">this.createOpera</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 84</span> 		
<span class='line'> 85</span> 		</span><span class="COMM">/*Get our initial location*/</span><span class="WHIT">
<span class='line'> 86</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">initialHash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getCurrentLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> 
<span class='line'> 88</span> 		</span><span class="COMM">/*Save it as our current location*/</span><span class="WHIT">
<span class='line'> 89</span> 		</span><span class="NAME">this.currentLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initialHash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 90</span> 
<span class='line'> 91</span> 		</span><span class="COMM">/*Now that we have a hash, create IE-specific code*/</span><span class="WHIT">
<span class='line'> 92</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isIE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> 			</span><span class="NAME">this.createIE</span><span class="PUNC">(</span><span class="NAME">initialHash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 95</span> 
<span class='line'> 96</span> 		</span><span class="COMM">/*Add an unload listener for the page; this is needed for FF 1.5+ because this browser caches all dynamic updates to the
<span class='line'> 97</span> 		page, which can break some of our logic related to testing whether this is the first instance a page has loaded or whether
<span class='line'> 98</span> 		it is being pulled from the cache*/</span><span class="WHIT">
<span class='line'> 99</span> 
<span class='line'>100</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">unloadHandler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>101</span> 			</span><span class="NAME">that.firstLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>102</span> 		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>103</span> 		
<span class='line'>104</span> 		</span><span class="NAME">this.addEventListener</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="STRN">'unload'</span><span class="PUNC">,</span><span class="NAME">unloadHandler</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">		
<span class='line'>105</span> 
<span class='line'>106</span> 		</span><span class="COMM">/*Determine if this is our first page load; for IE, we do this in this.iframeLoaded(), which is fired on pageload. We do it
<span class='line'>107</span> 		there because we have no historyStorage at this point, which only exists after the page is finished loading in IE*/</span><span class="WHIT">
<span class='line'>108</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isIE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>109</span> 			</span><span class="COMM">/*The iframe will get loaded on page load, and we want to ignore this fact*/</span><span class="WHIT">
<span class='line'>110</span> 			</span><span class="NAME">this.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>111</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>112</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">historyStorage.hasKey</span><span class="PUNC">(</span><span class="NAME">this.PAGELOADEDSTRING</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> 				</span><span class="COMM">/*This is our first page load, so ignore the location change and add our special history entry*/</span><span class="WHIT">
<span class='line'>114</span> 				</span><span class="NAME">this.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> 				</span><span class="NAME">this.firstLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> 				</span><span class="NAME">historyStorage.put</span><span class="PUNC">(</span><span class="NAME">this.PAGELOADEDSTRING</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> 			</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>118</span> 				</span><span class="COMM">/*This isn't our first page load, so indicate that we want to pay attention to this location change*/</span><span class="WHIT">
<span class='line'>119</span> 				</span><span class="NAME">this.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span> 				</span><span class="COMM">/*For browsers other than IE, fire a history change event; on IE, the event will be thrown automatically when its
<span class='line'>121</span> 				hidden iframe reloads on page load. Unfortunately, we don't have any listeners yet; indicate that we want to fire
<span class='line'>122</span> 				an event when a listener is added.*/</span><span class="WHIT">
<span class='line'>123</span> 				</span><span class="NAME">this.fireOnNewListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>125</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>126</span> 
<span class='line'>127</span> 		</span><span class="COMM">/*Other browsers can use a location handler that checks at regular intervals as their primary mechanism; we use it for IE as
<span class='line'>128</span> 		well to handle an important edge case; see checkLocation() for details*/</span><span class="WHIT">
<span class='line'>129</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">locationHandler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>130</span> 			</span><span class="NAME">that.checkLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>131</span> 		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>132</span> 		</span><span class="NAME">setInterval</span><span class="PUNC">(</span><span class="NAME">locationHandler</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">	
<span class='line'>134</span> 	
<span class='line'>135</span> 	</span><span class="COMM">/*Public: Initialize our DHTML history. You must call this after the page is finished loading.*/</span><span class="WHIT">
<span class='line'>136</span> 	</span><span class="NAME">initialize</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>137</span> 		</span><span class="COMM">/*IE needs to be explicitly initialized. IE doesn't autofill form data until the page is finished loading, so we have to wait*/</span><span class="WHIT">
<span class='line'>138</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isIE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>139</span> 			</span><span class="COMM">/*If this is the first time this page has loaded*/</span><span class="WHIT">
<span class='line'>140</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">historyStorage.hasKey</span><span class="PUNC">(</span><span class="NAME">this.PAGELOADEDSTRING</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>141</span> 				</span><span class="COMM">/*For IE, we do this in initialize(); for other browsers, we do it in create()*/</span><span class="WHIT">
<span class='line'>142</span> 				</span><span class="NAME">this.fireOnNewListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</span> 				</span><span class="NAME">this.firstLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> 				</span><span class="NAME">historyStorage.put</span><span class="PUNC">(</span><span class="NAME">this.PAGELOADEDSTRING</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>146</span> 			</span><span class="COMM">/*Else if this is a fake onload event*/</span><span class="WHIT">
<span class='line'>147</span> 			</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>148</span> 				</span><span class="NAME">this.fireOnNewListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>149</span> 				</span><span class="NAME">this.firstLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">   
<span class='line'>150</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>151</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>152</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>153</span> 
<span class='line'>154</span> 	</span><span class="COMM">/*Public: Adds a history change listener. Note that only one listener is supported at this time.*/</span><span class="WHIT">
<span class='line'>155</span> 	</span><span class="NAME">addListener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>156</span> 		</span><span class="NAME">this.listener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> 		</span><span class="COMM">/*If the page was just loaded and we should not ignore it, fire an event to our new listener now*/</span><span class="WHIT">
<span class='line'>158</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.fireOnNewListener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> 			</span><span class="NAME">this.fireHistoryEvent</span><span class="PUNC">(</span><span class="NAME">this.currentLocation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> 			</span><span class="NAME">this.fireOnNewListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>162</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>163</span> 	
<span class='line'>164</span> 	</span><span class="COMM">/*Public: Generic utility function for attaching events*/</span><span class="WHIT">
<span class='line'>165</span> 	</span><span class="NAME">addEventListener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">l</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>166</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o.addEventListener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>167</span> 			</span><span class="NAME">o.addEventListener</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">l</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o.attachEvent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>169</span> 			</span><span class="NAME">o.attachEvent</span><span class="PUNC">(</span><span class="STRN">'on'</span><span class="PUNC">+</span><span class="NAME">e</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>170</span> 				</span><span class="NAME">l</span><span class="PUNC">(</span><span class="NAME">window.event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> 			</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>173</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>174</span> 	
<span class='line'>175</span> 	</span><span class="COMM">/*Public: Add a history point.*/</span><span class="WHIT">
<span class='line'>176</span> 	</span><span class="NAME">add</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">historyData</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>177</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isSafari</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>178</span> 			
<span class='line'>179</span> 			</span><span class="COMM">/*Remove any leading hash symbols on newLocation*/</span><span class="WHIT">
<span class='line'>180</span> 			</span><span class="NAME">newLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.removeHash</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span> 
<span class='line'>182</span> 			</span><span class="COMM">/*Store the history data into history storage*/</span><span class="WHIT">
<span class='line'>183</span> 			</span><span class="NAME">historyStorage.put</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">historyData</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> 
<span class='line'>185</span> 			</span><span class="COMM">/*Save this as our current location*/</span><span class="WHIT">
<span class='line'>186</span> 			</span><span class="NAME">this.currentLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>187</span> 	
<span class='line'>188</span> 			</span><span class="COMM">/*Change the browser location*/</span><span class="WHIT">
<span class='line'>189</span> 			</span><span class="NAME">window.location.hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>190</span> 		
<span class='line'>191</span> 			</span><span class="COMM">/*Save this to the Safari form field*/</span><span class="WHIT">
<span class='line'>192</span> 			</span><span class="NAME">this.putSafariState</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>194</span> 			
<span class='line'>195</span> 			</span><span class="COMM">/*Most browsers require that we wait a certain amount of time before changing the location, such
<span class='line'>196</span> 			as 200 MS; rather than forcing external callers to use window.setTimeout to account for this,
<span class='line'>197</span> 			we internally handle it by putting requests in a queue.*/</span><span class="WHIT">
<span class='line'>198</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">that</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">addImpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>200</span> 
<span class='line'>201</span> 				</span><span class="COMM">/*Indicate that the current wait time is now less*/</span><span class="WHIT">
<span class='line'>202</span> 				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">that.currentWaitTime</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>203</span> 					</span><span class="NAME">that.currentWaitTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">that.currentWaitTime</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">that.waitTime</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> 				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>205</span> 			
<span class='line'>206</span> 				</span><span class="COMM">/*Remove any leading hash symbols on newLocation*/</span><span class="WHIT">
<span class='line'>207</span> 				</span><span class="NAME">newLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">that.removeHash</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>208</span> 
<span class='line'>209</span> 				</span><span class="COMM">/*IE has a strange bug; if the newLocation is the same as _any_ preexisting id in the
<span class='line'>210</span> 				document, then the history action gets recorded twice; throw a programmer exception if
<span class='line'>211</span> 				there is an element with this ID*/</span><span class="WHIT">
<span class='line'>212</span> 				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">that.debugMode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>213</span> 					</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Exception: History locations can not have the same value as _any_ IDs that might be in the document,"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'>214</span> 						</span><span class="STRN">" due to a bug in IE; please ask the developer to choose a history location that does not match any HTML"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'>215</span> 						</span><span class="STRN">" IDs in this document. The following ID is already taken and cannot be a location: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> 					</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>217</span> 				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>218</span> 
<span class='line'>219</span> 				</span><span class="COMM">/*Store the history data into history storage*/</span><span class="WHIT">
<span class='line'>220</span> 				</span><span class="NAME">historyStorage.put</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">historyData</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>221</span> 
<span class='line'>222</span> 				</span><span class="COMM">/*Indicate to the browser to ignore this upcomming location change since we're making it programmatically*/</span><span class="WHIT">
<span class='line'>223</span> 				</span><span class="NAME">that.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> 
<span class='line'>225</span> 				</span><span class="COMM">/*Indicate to IE that this is an atomic location change block*/</span><span class="WHIT">
<span class='line'>226</span> 				</span><span class="NAME">that.ieAtomicLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>227</span> 
<span class='line'>228</span> 				</span><span class="COMM">/*Save this as our current location*/</span><span class="WHIT">
<span class='line'>229</span> 				</span><span class="NAME">that.currentLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>230</span> 		
<span class='line'>231</span> 				</span><span class="COMM">/*Change the browser location*/</span><span class="WHIT">
<span class='line'>232</span> 				</span><span class="NAME">window.location.hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>233</span> 
<span class='line'>234</span> 				</span><span class="COMM">/*Change the hidden iframe's location if on IE*/</span><span class="WHIT">
<span class='line'>235</span> 				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">that.isIE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>236</span> 					</span><span class="NAME">that.iframe.src</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"/javascripts/lib/blank.html?"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> 				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>238</span> 
<span class='line'>239</span> 				</span><span class="COMM">/*End of atomic location change block for IE*/</span><span class="WHIT">
<span class='line'>240</span> 				</span><span class="NAME">that.ieAtomicLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> 			</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> 
<span class='line'>243</span> 			</span><span class="COMM">/*Now queue up this add request*/</span><span class="WHIT">
<span class='line'>244</span> 			</span><span class="NAME">window.setTimeout</span><span class="PUNC">(</span><span class="NAME">addImpl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.currentWaitTime</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>245</span> 
<span class='line'>246</span> 			</span><span class="COMM">/*Indicate that the next request will have to wait for awhile*/</span><span class="WHIT">
<span class='line'>247</span> 			</span><span class="NAME">this.currentWaitTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.currentWaitTime</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.waitTime</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>248</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>249</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>250</span> 
<span class='line'>251</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>252</span> 	</span><span class="NAME">isFirstLoad</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>253</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.firstLoad</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>254</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>255</span> 
<span class='line'>256</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>257</span> 	</span><span class="NAME">getVersion</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>258</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"0.6"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>259</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>260</span> 
<span class='line'>261</span> 	</span><span class="COMM">/*Get browser's current hash location; for Safari, read value from a hidden form field*/</span><span class="WHIT">
<span class='line'>262</span> 
<span class='line'>263</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>264</span> 	</span><span class="NAME">getCurrentLocation</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>265</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isSafari</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">this.getSafariState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.getCurrentHash</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>266</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>268</span> 	
<span class='line'>269</span> 	</span><span class="COMM">/*Public: Manually parse the current url for a hash; tip of the hat to YUI*/</span><span class="WHIT">
<span class='line'>270</span>     </span><span class="NAME">getCurrentHash</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>271</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.location.href</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>272</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">r.indexOf</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">r.substr</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>274</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>275</span> 	
<span class='line'>276</span> 	</span><span class="COMM">/*- - - - - - - - - - - -*/</span><span class="WHIT">
<span class='line'>277</span> 	
<span class='line'>278</span> 	</span><span class="COMM">/*Private: Constant for our own internal history event called when the page is loaded*/</span><span class="WHIT">
<span class='line'>279</span> 	</span><span class="NAME">PAGELOADEDSTRING</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"DhtmlHistory_pageLoaded"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>280</span> 	
<span class='line'>281</span> 	</span><span class="COMM">/*Private: Our history change listener.*/</span><span class="WHIT">
<span class='line'>282</span> 	</span><span class="NAME">listener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>283</span> 
<span class='line'>284</span> 	</span><span class="COMM">/*Private: MS to wait between add requests - will be reset for certain browsers*/</span><span class="WHIT">
<span class='line'>285</span> 	</span><span class="NAME">waitTime</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>286</span> 	
<span class='line'>287</span> 	</span><span class="COMM">/*Private: MS before an add request can execute*/</span><span class="WHIT">
<span class='line'>288</span> 	</span><span class="NAME">currentWaitTime</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>289</span> 
<span class='line'>290</span> 	</span><span class="COMM">/*Private: Our current hash location, without the "#" symbol.*/</span><span class="WHIT">
<span class='line'>291</span> 	</span><span class="NAME">currentLocation</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>292</span> 
<span class='line'>293</span> 	</span><span class="COMM">/*Private: Hidden iframe used to IE to detect history changes*/</span><span class="WHIT">
<span class='line'>294</span> 	</span><span class="NAME">iframe</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>295</span> 
<span class='line'>296</span> 	</span><span class="COMM">/*Private: Flags and DOM references used only by Safari*/</span><span class="WHIT">
<span class='line'>297</span> 	</span><span class="NAME">safariHistoryStartPoint</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>298</span> 	</span><span class="NAME">safariStack</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>299</span> 	</span><span class="NAME">safariLength</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>300</span> 
<span class='line'>301</span> 	</span><span class="COMM">/*Private: Flag used to keep checkLocation() from doing anything when it discovers location changes we've made ourselves
<span class='line'>302</span> 	programmatically with the add() method. Basically, add() sets this to true. When checkLocation() discovers it's true,
<span class='line'>303</span> 	it refrains from firing our listener, then resets the flag to false for next cycle. That way, our listener only gets fired on
<span class='line'>304</span> 	history change events triggered by the user via back/forward buttons and manual hash changes. This flag also helps us set up
<span class='line'>305</span> 	IE's special iframe-based method of handling history changes.*/</span><span class="WHIT">
<span class='line'>306</span> 	</span><span class="NAME">ignoreLocationChange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>307</span> 
<span class='line'>308</span> 	</span><span class="COMM">/*Private: A flag that indicates that we should fire a history change event when we are ready, i.e. after we are initialized and
<span class='line'>309</span> 	we have a history change listener. This is needed due to an edge case in browsers other than IE; if you leave a page entirely
<span class='line'>310</span> 	then return, we must fire this as a history change event. Unfortunately, we have lost all references to listeners from earlier,
<span class='line'>311</span> 	because JavaScript clears out.*/</span><span class="WHIT">
<span class='line'>312</span> 	</span><span class="NAME">fireOnNewListener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>313</span> 
<span class='line'>314</span> 	</span><span class="COMM">/*Private: A variable that indicates whether this is the first time this page has been loaded. If you go to a web page, leave it
<span class='line'>315</span> 	for another one, and then return, the page's onload listener fires again. We need a way to differentiate between the first page
<span class='line'>316</span> 	load and subsequent ones. This variable works hand in hand with the pageLoaded variable we store into historyStorage.*/</span><span class="WHIT">
<span class='line'>317</span> 	</span><span class="NAME">firstLoad</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>318</span> 
<span class='line'>319</span> 	</span><span class="COMM">/*Private: A variable to handle an important edge case in IE. In IE, if a user manually types an address into their browser's
<span class='line'>320</span> 	location bar, we must intercept this by calling checkLocation() at regular intervals. However, if we are programmatically
<span class='line'>321</span> 	changing the location bar ourselves using the add() method, we need to ignore these changes in checkLocation(). Unfortunately,
<span class='line'>322</span> 	these changes take several lines of code to complete, so for the duration of those lines of code, we set this variable to true.
<span class='line'>323</span> 	That signals to checkLocation() to ignore the change-in-progress. Once we're done with our chunk of location-change code in
<span class='line'>324</span> 	add(), we set this back to false. We'll do the same thing when capturing user-entered address changes in checkLocation itself.*/</span><span class="WHIT">
<span class='line'>325</span> 	</span><span class="NAME">ieAtomicLocationChange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>326</span> 	
<span class='line'>327</span> 	</span><span class="COMM">/*Private: Create IE-specific DOM nodes and overrides*/</span><span class="WHIT">
<span class='line'>328</span> 	</span><span class="NAME">createIE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">initialHash</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>329</span> 		</span><span class="COMM">/*write out a hidden iframe for IE and set the amount of time to wait between add() requests*/</span><span class="WHIT">
<span class='line'>330</span> 		</span><span class="NAME">this.waitTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">400</span><span class="PUNC">;</span><span class="COMM">/*IE needs longer between history updates*/</span><span class="WHIT">
<span class='line'>331</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">styles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">historyStorage.debugMode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'width: 800px;height:80px;border:1px solid black;'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">iframeID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshHistoryFrame"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>333</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">iframeHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;iframe frameborder="0" id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">iframeID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">styles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" src="/javascripts/lib/blank.html?'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">initialHash</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'">&lt;/iframe>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>334</span> 		</span><span class="NAME">document.write</span><span class="PUNC">(</span><span class="NAME">iframeHTML</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> 		</span><span class="NAME">this.iframe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">iframeID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>337</span> 	
<span class='line'>338</span> 	</span><span class="COMM">/*Private: Create Opera-specific DOM nodes and overrides*/</span><span class="WHIT">
<span class='line'>339</span> 	</span><span class="NAME">createOpera</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>340</span> 		</span><span class="NAME">this.waitTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">400</span><span class="PUNC">;</span><span class="COMM">/*Opera needs longer between history updates*/</span><span class="WHIT">
<span class='line'>341</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">imgHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" />'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> 		</span><span class="NAME">document.write</span><span class="PUNC">(</span><span class="NAME">imgHTML</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>343</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>344</span> 	
<span class='line'>345</span> 	</span><span class="COMM">/*Private: Create Safari-specific DOM nodes and overrides*/</span><span class="WHIT">
<span class='line'>346</span> 	</span><span class="NAME">createSafari</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>347</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">formID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshSafariForm"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>348</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stackID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshSafariStack"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lengthID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshSafariLength"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>350</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">formStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">historyStorage.debugMode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">historyStorage.showStyles</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>351</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">inputStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">historyStorage.debugMode</span><span class="WHIT">	</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'width:800px;height:20px;border:1px solid black;margin:0;padding:0;'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">safariHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;form id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">formID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">formStyles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'">'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'>353</span> 			</span><span class="STRN">'&lt;input type="text" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">inputStyles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">stackID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" value="[]"/>'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'>354</span> 			</span><span class="STRN">'&lt;input type="text" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">inputStyles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">lengthID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" value=""/>'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'>355</span> 			</span><span class="STRN">'&lt;/form>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>356</span> 		</span><span class="NAME">document.write</span><span class="PUNC">(</span><span class="NAME">safariHTML</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> 		</span><span class="NAME">this.safariStack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">stackID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>358</span> 		</span><span class="NAME">this.safariLength</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">lengthID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>359</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">historyStorage.hasKey</span><span class="PUNC">(</span><span class="NAME">this.PAGELOADEDSTRING</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>360</span> 			</span><span class="NAME">this.safariHistoryStartPoint</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">history.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>361</span> 			</span><span class="NAME">this.safariLength.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.safariHistoryStartPoint</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>362</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>363</span> 			</span><span class="NAME">this.safariHistoryStartPoint</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.safariLength.value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>365</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>366</span> 	
<span class='line'>367</span> 	</span><span class="COMM">/*Private: Safari method to read the history stack from a hidden form field*/</span><span class="WHIT">
<span class='line'>368</span> 	</span><span class="NAME">getSafariStack</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>369</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.safariStack.value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>370</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">historyStorage.fromJSON</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>371</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>372</span> 
<span class='line'>373</span> 	</span><span class="COMM">/*Private: Safari method to read from the history stack*/</span><span class="WHIT">
<span class='line'>374</span> 	</span><span class="NAME">getSafariState</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>375</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getSafariStack</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>376</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">stack</span><span class="PUNC">[</span><span class="NAME">history.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.safariHistoryStartPoint</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">state</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>378</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">			
<span class='line'>379</span> 	</span><span class="COMM">/*Private: Safari method to write the history stack to a hidden form field*/</span><span class="WHIT">
<span class='line'>380</span> 	</span><span class="NAME">putSafariState</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>381</span> 	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getSafariStack</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>382</span> 	    </span><span class="NAME">stack</span><span class="PUNC">[</span><span class="NAME">history.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.safariHistoryStartPoint</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newLocation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>383</span> 	    </span><span class="NAME">this.safariStack.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">historyStorage.toJSON</span><span class="PUNC">(</span><span class="NAME">stack</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>384</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>385</span> 
<span class='line'>386</span> 	</span><span class="COMM">/*Private: Notify the listener of new history changes.*/</span><span class="WHIT">
<span class='line'>387</span> 	</span><span class="NAME">fireHistoryEvent</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newHash</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>388</span> 		</span><span class="COMM">/*extract the value from our history storage for this hash*/</span><span class="WHIT">
<span class='line'>389</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">historyData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">historyStorage.get</span><span class="PUNC">(</span><span class="NAME">newHash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>390</span> 		</span><span class="COMM">/*call our listener*/</span><span class="WHIT">
<span class='line'>391</span> 		</span><span class="NAME">this.listener.call</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">newHash</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">historyData</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>393</span> 	
<span class='line'>394</span> 	</span><span class="COMM">/*Private: See if the browser has changed location. This is the primary history mechanism for Firefox. For IE, we use this to
<span class='line'>395</span> 	handle an important edge case: if a user manually types in a new hash value into their IE location bar and press enter, we want to
<span class='line'>396</span> 	to intercept this and notify any history listener.*/</span><span class="WHIT">
<span class='line'>397</span> 	</span><span class="NAME">checkLocation</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>398</span> 		
<span class='line'>399</span> 		</span><span class="COMM">/*Ignore any location changes that we made ourselves for browsers other than IE*/</span><span class="WHIT">
<span class='line'>400</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.isIE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.ignoreLocationChange</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>401</span> 			</span><span class="NAME">this.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>402</span> 			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>403</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>404</span> 
<span class='line'>405</span> 		</span><span class="COMM">/*If we are dealing with IE and we are in the middle of making a location change from an iframe, ignore it*/</span><span class="WHIT">
<span class='line'>406</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.isIE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.ieAtomicLocationChange</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>407</span> 			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>408</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>409</span> 		
<span class='line'>410</span> 		</span><span class="COMM">/*Get hash location*/</span><span class="WHIT">
<span class='line'>411</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getCurrentLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>412</span> 
<span class='line'>413</span> 		</span><span class="COMM">/*Do nothing if there's been no change*/</span><span class="WHIT">
<span class='line'>414</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">this.currentLocation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>415</span> 			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>417</span> 
<span class='line'>418</span> 		</span><span class="COMM">/*In IE, users manually entering locations into the browser; we do this by comparing the browser's location against the
<span class='line'>419</span> 		iframe's location; if they differ, we are dealing with a manual event and need to place it inside our history, otherwise
<span class='line'>420</span> 		we can return*/</span><span class="WHIT">
<span class='line'>421</span> 		</span><span class="NAME">this.ieAtomicLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>422</span> 
<span class='line'>423</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isIE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.getIframeHash</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>424</span> 			</span><span class="NAME">this.iframe.src</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"/javascripts/lib/blank.html?"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>425</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>426</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isIE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>427</span> 			</span><span class="COMM">/*the iframe is unchanged*/</span><span class="WHIT">
<span class='line'>428</span> 			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>429</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>430</span> 
<span class='line'>431</span> 		</span><span class="COMM">/*Save this new location*/</span><span class="WHIT">
<span class='line'>432</span> 		</span><span class="NAME">this.currentLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>433</span> 
<span class='line'>434</span> 		</span><span class="NAME">this.ieAtomicLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>435</span> 
<span class='line'>436</span> 		</span><span class="COMM">/*Notify listeners of the change*/</span><span class="WHIT">
<span class='line'>437</span> 		</span><span class="NAME">this.fireHistoryEvent</span><span class="PUNC">(</span><span class="NAME">hash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>438</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>439</span> 
<span class='line'>440</span> 	</span><span class="COMM">/*Private: Get the current location of IE's hidden iframe.*/</span><span class="WHIT">
<span class='line'>441</span> 	</span><span class="NAME">getIframeHash</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>442</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">doc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.iframe.contentWindow.document</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>443</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">doc.location.search</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>444</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hash.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hash.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>445</span> 			</span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>446</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>447</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hash.length</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hash.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>448</span> 			</span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hash.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>449</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>450</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>451</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>452</span> 
<span class='line'>453</span> 	</span><span class="COMM">/*Private: Remove any leading hash that might be on a location.*/</span><span class="WHIT">
<span class='line'>454</span> 	</span><span class="NAME">removeHash</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hashValue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>455</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>456</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hashValue</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">hashValue</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>457</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>458</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>459</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hashValue</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>460</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>461</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>462</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hashValue.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hashValue.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>463</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>464</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>465</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hashValue.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hashValue.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>466</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hashValue.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>467</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>468</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>469</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hashValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>470</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>471</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>472</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>473</span> 
<span class='line'>474</span> 	</span><span class="COMM">/*Private: For IE, tell when the hidden iframe has finished loading.*/</span><span class="WHIT">
<span class='line'>475</span> 	</span><span class="NAME">iframeLoaded</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newLocation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>476</span> 		</span><span class="COMM">/*ignore any location changes that we made ourselves*/</span><span class="WHIT">
<span class='line'>477</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.ignoreLocationChange</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>478</span> 			</span><span class="NAME">this.ignoreLocationChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>479</span> 			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>480</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>481</span> 
<span class='line'>482</span> 		</span><span class="COMM">/*Get the new location*/</span><span class="WHIT">
<span class='line'>483</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">newLocation.search</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>484</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hash.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hash.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>485</span> 			</span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>486</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>487</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hash.length</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hash.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>488</span> 			</span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hash.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>489</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>490</span> 		</span><span class="COMM">/*Keep the browser location bar in sync with the iframe hash*/</span><span class="WHIT">
<span class='line'>491</span> 		</span><span class="NAME">window.location.hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>492</span> 
<span class='line'>493</span> 		</span><span class="COMM">/*Notify listeners of the change*/</span><span class="WHIT">
<span class='line'>494</span> 		</span><span class="NAME">this.fireHistoryEvent</span><span class="PUNC">(</span><span class="NAME">hash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>495</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>496</span> 
<span class='line'>497</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>498</span> 
<span class='line'>499</span> </span><span class="COMM">/*
<span class='line'>500</span> 	historyStorage: An object that uses a hidden form to store history state across page loads. The mechanism for doing so relies on
<span class='line'>501</span> 	the fact that browsers save the text in form data for the life of the browser session, which means the text is still there when
<span class='line'>502</span> 	the user navigates back to the page. This object can be used independently of the dhtmlHistory object for caching of Ajax
<span class='line'>503</span> 	session information.
<span class='line'>504</span> 	
<span class='line'>505</span> 	dependencies: 
<span class='line'>506</span> 		* json2007.js (included in a separate file) or alternate JSON methods passed in through an options bundle.
<span class='line'>507</span> */</span><span class="WHIT">
<span class='line'>508</span> </span><span class="NAME">historyStorage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>509</span> 	
<span class='line'>510</span> 	</span><span class="COMM">/*Public: Set up our historyStorage object for use by dhtmlHistory or other objects*/</span><span class="WHIT">
<span class='line'>511</span> 	</span><span class="NAME">setup</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>512</span> 		
<span class='line'>513</span> 		</span><span class="COMM">/*
<span class='line'>514</span> 			options - object to store initialization parameters - passed in from dhtmlHistory or directly into historyStorage
<span class='line'>515</span> 			options.debugMode - boolean that causes hidden form fields to be shown for development purposes.
<span class='line'>516</span> 			options.toJSON - function to override default JSON stringifier
<span class='line'>517</span> 			options.fromJSON - function to override default JSON parser
<span class='line'>518</span> 		*/</span><span class="WHIT">
<span class='line'>519</span> 
<span class='line'>520</span> 		</span><span class="COMM">/*process init parameters*/</span><span class="WHIT">
<span class='line'>521</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>522</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.debugMode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>523</span> 				</span><span class="NAME">this.debugMode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.debugMode</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>524</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>525</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.toJSON</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>526</span> 				</span><span class="NAME">this.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.toJSON</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>527</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>528</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.fromJSON</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>529</span> 				</span><span class="NAME">this.fromJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.fromJSON</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>530</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>531</span> 		</span><span class="PUNC">}</span><span class="WHIT">		
<span class='line'>532</span> 		
<span class='line'>533</span> 		</span><span class="COMM">/*write a hidden form and textarea into the page; we'll stow our history stack here*/</span><span class="WHIT">
<span class='line'>534</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">formID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshStorageForm"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>535</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">textareaID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"rshStorageField"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>536</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">formStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.debugMode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">historyStorage.showStyles</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>537</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">textareaStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">historyStorage.debugMode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'width: 800px;height:80px;border:1px solid black;'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">historyStorage.hideStyles</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>538</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">textareaHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&lt;textarea id="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">textareaID</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'" style="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">textareaStyles</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'">&lt;/textarea>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>539</span> 		</span><span class="NAME">document.write</span><span class="PUNC">(</span><span class="NAME">textareaHTML</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>540</span> 
<span class='line'>541</span> 		</span><span class="NAME">this.storageField</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">textareaID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>542</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window.opera</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>543</span> 			</span><span class="NAME">this.storageField.focus</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">/*Opera needs to focus this element before persisting values in it*/</span><span class="WHIT">
<span class='line'>544</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>545</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>546</span> 	
<span class='line'>547</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>548</span> 	</span><span class="NAME">put</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>549</span> 		</span><span class="NAME">this.assertValidKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>550</span> 		</span><span class="COMM">/*if we already have a value for this, remove the value before adding the new one*/</span><span class="WHIT">
<span class='line'>551</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.hasKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>552</span> 			</span><span class="NAME">this.remove</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>554</span> 		</span><span class="COMM">/*store this new key*/</span><span class="WHIT">
<span class='line'>555</span> 		</span><span class="NAME">this.storageHash</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>556</span> 		</span><span class="COMM">/*save and serialize the hashtable into the form*/</span><span class="WHIT">
<span class='line'>557</span> 		</span><span class="NAME">this.saveHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>558</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>559</span> 
<span class='line'>560</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>561</span> 	</span><span class="NAME">get</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>562</span> 		</span><span class="NAME">this.assertValidKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>563</span> 		</span><span class="COMM">/*make sure the hash table has been loaded from the form*/</span><span class="WHIT">
<span class='line'>564</span> 		</span><span class="NAME">this.loadHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>565</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.storageHash</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>566</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>567</span> 			</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>568</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>569</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>570</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>571</span> 
<span class='line'>572</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>573</span> 	</span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>574</span> 		</span><span class="NAME">this.assertValidKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>575</span> 		</span><span class="COMM">/*make sure the hash table has been loaded from the form*/</span><span class="WHIT">
<span class='line'>576</span> 		</span><span class="NAME">this.loadHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>577</span> 		</span><span class="COMM">/*delete the value*/</span><span class="WHIT">
<span class='line'>578</span> 		</span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">this.storageHash</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>579</span> 		</span><span class="COMM">/*serialize and save the hash table into the form*/</span><span class="WHIT">
<span class='line'>580</span> 		</span><span class="NAME">this.saveHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>581</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>582</span> 
<span class='line'>583</span> 	</span><span class="COMM">/*Public: Clears out all saved data.*/</span><span class="WHIT">
<span class='line'>584</span> 	</span><span class="NAME">reset</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>585</span> 		</span><span class="NAME">this.storageField.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>586</span> 		</span><span class="NAME">this.storageHash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>587</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>588</span> 
<span class='line'>589</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>590</span> 	</span><span class="NAME">hasKey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>591</span> 		</span><span class="NAME">this.assertValidKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>592</span> 		</span><span class="COMM">/*make sure the hash table has been loaded from the form*/</span><span class="WHIT">
<span class='line'>593</span> 		</span><span class="NAME">this.loadHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>594</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">this.storageHash</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>595</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>596</span> 
<span class='line'>597</span> 	</span><span class="COMM">/*Public*/</span><span class="WHIT">
<span class='line'>598</span> 	</span><span class="NAME">isValidKey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>599</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>600</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>601</span> 	
<span class='line'>602</span> 	</span><span class="COMM">/*Public - CSS strings utilized by both objects to hide or show behind-the-scenes DOM elements*/</span><span class="WHIT">
<span class='line'>603</span> 	</span><span class="NAME">showStyles</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'border:0;margin:0;padding:0;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>604</span> 	</span><span class="NAME">hideStyles</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>605</span> 	
<span class='line'>606</span> 	</span><span class="COMM">/*Public - debug mode flag*/</span><span class="WHIT">
<span class='line'>607</span> 	</span><span class="NAME">debugMode</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>608</span> 	
<span class='line'>609</span> 	</span><span class="COMM">/*- - - - - - - - - - - -*/</span><span class="WHIT">
<span class='line'>610</span> 
<span class='line'>611</span> 	</span><span class="COMM">/*Private: Our hash of key name/values.*/</span><span class="WHIT">
<span class='line'>612</span> 	</span><span class="NAME">storageHash</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>613</span> 
<span class='line'>614</span> 	</span><span class="COMM">/*Private: If true, we have loaded our hash table out of the storage form.*/</span><span class="WHIT">
<span class='line'>615</span> 	</span><span class="NAME">hashLoaded</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'>616</span> 
<span class='line'>617</span> 	</span><span class="COMM">/*Private: DOM reference to our history field*/</span><span class="WHIT">
<span class='line'>618</span> 	</span><span class="NAME">storageField</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>619</span> 
<span class='line'>620</span> 	</span><span class="COMM">/*Private: Assert that a key is valid; throw an exception if it not.*/</span><span class="WHIT">
<span class='line'>621</span> 	</span><span class="NAME">assertValidKey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>622</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isValid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.isValidKey</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>623</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">isValid</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.debugMode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>624</span> 			</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"Please provide a valid key for window.historyStorage. Invalid key = "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>625</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>626</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>627</span> 
<span class='line'>628</span> 	</span><span class="COMM">/*Private: Load the hash table up from the form.*/</span><span class="WHIT">
<span class='line'>629</span> 	</span><span class="NAME">loadHashTable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>630</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.hashLoaded</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">	
<span class='line'>631</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">serializedHashTable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.storageField.value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>632</span> 			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">serializedHashTable</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">serializedHashTable</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>633</span> 				</span><span class="NAME">this.storageHash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.fromJSON</span><span class="PUNC">(</span><span class="NAME">serializedHashTable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>634</span> 				</span><span class="NAME">this.hashLoaded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>635</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>636</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>637</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>638</span> 	</span><span class="COMM">/*Private: Save the hash table into the form.*/</span><span class="WHIT">
<span class='line'>639</span> 	</span><span class="NAME">saveHashTable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>640</span> 		</span><span class="NAME">this.loadHashTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>641</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">serializedHashTable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.toJSON</span><span class="PUNC">(</span><span class="NAME">this.storageHash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>642</span> 		</span><span class="NAME">this.storageField.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">serializedHashTable</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>643</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>644</span> 	</span><span class="COMM">/*Private: Bridges for our JSON implementations - both rely on 2007 JSON.org library - can be overridden by options bundle*/</span><span class="WHIT">
<span class='line'>645</span> 	</span><span class="NAME">toJSON</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>646</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">o.toJSONString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>647</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>648</span> 	</span><span class="NAME">fromJSON</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>649</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s.parseJSON</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>650</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>651</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>652</span> </span></pre></body></html>